package com.yc.cinema.mapper;

import com.yc.cinema.bean.Movie;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MovieMapper {

    Movie selectById(Integer id);

    List<Movie> selectByObj(Movie movie);

    /**
     * flag == 1 精确查询   name = ?
     * flag == 2 模糊查询   name like ?
     * flag == 3 为空查询   name is null
     * flag == 4 非空查询   name is not null
     *
     * @param name
     * @param flag
     * @return
     */
    List<Movie> selectByFlag(@Param("name") String n, @Param("flag") int f);

    /**
     * 数组和集合不属于单参数, 必须要命名
     * @param ids
     * @return
     */
    List<Movie> selectInIds(@Param("ids")Integer ... ids);

    @Select("select * from movie where name=#{name}")
    Movie selectByName(String name);

}
